how to solve reverse a doubly linked list